package cool.leeson.library.service.user;

import cool.leeson.library.dao.UserCreditDao;
import cool.leeson.library.entity.user.UserCredit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserCreditService {
    @Resource
    private UserCreditDao userCreditDao;

    public UserCredit queryById(String id) {
        return userCreditDao.queryById(id);
    }

    public UserCredit queryByUserId(String userId) {
        return userCreditDao.queryByUserId(userId);
    }

    public List<UserCredit> queryAllByLimit(UserCredit userCredit, Pageable pageable) {
        return userCreditDao.queryAllByLimit(userCredit, pageable);
    }

    public long count(UserCredit userCredit) {
        return userCreditDao.count(userCredit);
    }

    public int insert(UserCredit userCredit) {
        return userCreditDao.insert(userCredit);
    }

    public int insertBatch(List<UserCredit> userCredits) {
        return userCreditDao.insertBatch(userCredits);
    }

    public int insertOrUpdateBatch(List<UserCredit> userCredits) {
        return userCreditDao.insertOrUpdateBatch(userCredits);
    }

    public int update(UserCredit userCredit) {
        return userCreditDao.update(userCredit);
    }

    public int deleteById(String id) {
        return userCreditDao.deleteById(id);
    }

    public List<UserCredit> getAll() {
        return userCreditDao.queryAll();
    }
}
